<template>
	<view class="getdowns">
		<view class="goods-cards">
			<!-- 商品卡片 -->
			<view class="card-item" v-for="(item,index) in activityBoxList" :key="index">
				<view class="rig" @click="changeitemChecked(item)">
					<uni-icons :type="item.ischeck?'checkbox-filled':'circle'" size="26"
						:color="item.ischeck?'#FF7803':'#D0D0D0'" class="way-right">
					</uni-icons>
				</view>
				<!-- 卡片左侧 -->
				<view class="card-lef">
					<image class="card-img" :src="item.image" mode="aspectFill" />
				</view>
				<!-- 卡片右侧 -->
				<view class="card-rig">
					<view class="good-name">
						{{item.boxName}}
					</view>
					<view class="kinds">
						{{item.kind}}
					</view>
					<view class="good-details">
						<view class="goodprice">
							<text class="title">寄售价:</text><text class="price">￥{{item.preprice}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 底部按钮 -->
		<view class="Bottombtn">
			<view class="bottombtn">
				<view class="tosell">
					<view class="rig" @click="changeChecked">
						<uni-icons :type="isalldone?'checkbox-filled':'circle'" size="26"
							:color="isalldone?'#FF7803':'#D0D0D0'" class="way-right">checkedprice
						</uni-icons>
					</view>
					<text class="allchoose">
						全选
					</text>
					<view class="tosend">
						<text class="choose">已选（{{havecheck}}/{{this.activityBoxList.length}}）</text>
						<text class="total">合计：<text class="price">￥30.36</text> </text>
					</view>
				</view>

				<view class="toexchange btn">
					批量下架
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				tips: '7.5折快速寄售，无需等待',
				readcheck: true,
				activityBoxList: [{
					image: this.imagesUrl('littlegirl.png'),
					boxName: "盲盒名称盲盒名称盲盒名称盲盒名称盲盒名称盲盒名称",
					kind: '普通款',
					boxStatus: 1,
					preprice: '30.36',
					getway: '抽盒方式',
					gettime: '2023/08/17 15:16:48',
					ischeck: true
				}, {
					image: this.imagesUrl('littlegirl.png'),
					boxName: "盲盒名称盲盒名称盲盒名称盲盒名称盲盒名称盲盒名称",
					kind: '普通款',
					boxStatus: 1,
					preprice: '30.36',
					getway: '抽盒方式',
					gettime: '2023/08/17 15:16:48',
					ischeck: true
				}, {
					image: this.imagesUrl('littlegirl.png'),
					boxName: "盲盒名称盲盒名称盲盒名称盲盒名称盲盒名称盲盒名称",
					kind: '普通款',
					boxStatus: 1,
					preprice: '30.36',
					getway: '抽盒方式',
					gettime: '2023/08/17 15:16:48',
					ischeck: true
				}, {
					image: this.imagesUrl('littlegirl.png'),
					boxName: "盲盒名称盲盒名称盲盒名称盲盒名称盲盒名称盲盒名称",
					kind: '普通款',
					boxStatus: 1,
					preprice: '30.36',
					getway: '抽盒方式',
					gettime: '2023/08/17 15:16:48',
					ischeck: true
				}, {
					image: this.imagesUrl('littlegirl.png'),
					boxName: "盲盒名称盲盒名称盲盒名称盲盒名称盲盒名称盲盒名称",
					kind: '普通款',
					boxStatus: 1,
					preprice: '30.36',
					getway: '抽盒方式',
					gettime: '2023/08/17 15:16:48',
					ischeck: true
				}, ],
			}
		},
		computed: {
			// 是否全选
			isalldone() {
				return this.activityBoxList.every(item => item.ischeck == true)
			},
			// 已勾选个数
			havecheck() {
				return this.activityBoxList.filter(item => item.ischeck == true).length
			},
			// 已勾选个数的总价



		},
		methods: {
			// 改变阅读状态
			changeChecked(e) {
				this.readcheck = !this.readcheck
				this.activityBoxList.forEach(item => item.ischeck = this.readcheck)
			},
			// 改变单个选中状态
			changeitemChecked(item) {
				item.ischeck = !item.ischeck
				this.readcheck = this.activityBoxList.every(item => item.ischeck == true)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.getdowns {
		.tips {
			width: 750rpx;
			height: 72rpx;
			font-size: 24rpx;
			line-height: 72rpx;
			color: #ff7803;
			background: #fff1e5;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.word {
				margin-left: 30rpx
			}

			image {
				width: 32rpx;
				height: 32rpx;
				margin-right: 30rpx;
			}

		}

		// 商品卡片样式
		.goods-cards {
			padding-bottom: 100rpx;

			.card-item {
				padding-left: 10rpx;
				color: #333333;
				// width: 690rpx;
				height: 244rpx;
				background-color: #ffffff;
				display: flex;
				justify-content: left;
				align-items: center;
				position: relative;

				box-sizing: border-box;

				.way-right {
					margin-right: 12rpx;
				}

				.card-lef {
					width: 180rpx;
					height: 180rpx;
					overflow: hidden;
					border-radius: 16rpx;

					.card-img {
						width: 100%;
						height: 100%;
					}
				}

				.card-rig {
					width: 472rpx;
					height: 180rpx;
					display: flex;
					flex-direction: column;
					position: relative;
					margin-left: 30rpx;

					.good-name {
						height: 44rpx;
						width: 440rpx;
						font-size: 26rpx;
						line-height: 44rpx;
						letter-spacing: 0.64px;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
					}

					.kinds {
						font-size: 24rpx;
						line-height: 32rpx;
						margin-top: 20rpx;
						color: #999999;
					}

					.good-details {
						margin-top: 16rpx;
						display: flex;
						justify-content: space-between;
						align-item: center;
						text-align: right;
						line-height: 20rpx;

						.goodprice {
							text-align: center;

							line-height: 32rpx;
							font-size: 32rpx;
							color: #333333;
							position: absolute;
							bottom: 0;
							display: flex;
							align-items: center;

							.title {

								font-size: 24rpx;
								line-height: 32rpx;

							}

							.price {

								font-weight: 500;
								width: 148rpx;
								height: 56rpx;
								font-size: 32rpx;
								line-height: 56rpx;
								border-radius: 32rpx;
								border: none;
							}
						}
					}
				}
			}
		}

		.Bottombtn {

			padding-bottom: constant(safe-area-inset-bottom);
			padding-bottom: env(safe-area-inset-bottom);
			position: fixed;
			bottom: 0;
			background-color: #ffffff;

			.bottombtn {
				width: 750rpx;
				height: 120rpx;
				background-color: white;
				display: flex;
				justify-content: space-between;
				align-items: center;



				.btn {

					height: 88rpx;
					border-radius: 44rpx;
					color: white;
					text-align: center;
					line-height: 88rpx;
					font-size: 28rpx;
					font-weight: 1000;
				}

				.tosell {
					margin-left: 10rpx;
					display: flex;
					align-items: center;


					.allchoose {
						margin-left: 8rpx;
						margin-right: 32rpx;
					}
				}

				.tosend {
					width: 192rpx;
					height: 88rpx;
					display: flex;
					flex-direction: column;
					// align-items: center;
					justify-content: space-between;

					.choose {
						color: #999999;
						font-size: 24rpx;
					}

					.total {
						font-size: 28rpx;
						width: 240rpx;

						.price {

							color: #F51F43;
							font-size: 36rpx;
						}
					}
				}

				.toexchange {
					margin-right: 30rpx;
					background-color: #FF7803;
					width: 240rpx;
				}
			}
		}




	}
</style>